#ifndef ENGINE_H
#define ENGINE_H

#include <log4qt/logger.h>
#include <defs/global.h>
#include <core/entityobject.h>
#include <QtDeclarative>

namespace Opl {
    namespace Gui {
        class Scene;
    }

    namespace Helpers {
        namespace Support{
            class Environment;
        }
    }
}

class Tasks;
class Zones;
class WindowsManager;
class Plugins;
class DeclarativeEnvironmentEx;
class LocalServer;
namespace Optra{ namespace Engine{ namespace Server {
class ConnectionsManager;
}}}

O_PRIVATE_DECLARE(Engine);
class Engine : public Opl::Core::EntityObject
{
    Q_OBJECT
	LOG4QT_DECLARE_QCLASS_LOGGER
public:	
    Engine(Engine *parent = 0);
    virtual ~Engine();
    bool initialize();
    void finalize();    
    int exec();

    QGraphicsScene* scene();
    Tasks* tasks();
    Zones* zones();
    WindowsManager* windowsManager();
    Opl::Helpers::Support::Environment* environment();
    Plugins* plugins();
    DeclarativeEnvironmentEx* qml();
    LocalServer* localServer();
	Optra::Engine::Server::ConnectionsManager* connectionsManager();

	QSettings* settings();
    static Engine* instance();
signals:

public slots:
    void reloadGui();
    void reloadTasks();
private:
    void prepareScenes();
    O_PRIVATE_DECLARE_MEMBER(Engine)
};


#endif // ENGINE_H
